


function parserHTML(html) {
    //可以不停的截取模板 直到把模板全部解析完毕
    let stack = [];
    let root = null;
    //我要构建父子关系
    function createASTElement(tg,attrs,parent) {
        return {
                tag, 
                type: 1,//元素
                children: [],
                parent,
                attrs
        }
    }
    function start(tag,attrs) {
        //遇到开始标签
        let parent = stack[stack.length-1];
        let element = createASTElement(tag,attrs,parent);
        if(root == null){
            root = element;
        }
        if (parent){
            element.parent = parent;//更新p的parent属性 指向parent
            parent.children.push(element);    
        }
        stack.push(element);
    }

    function end(tagName) {
        let endTag = stack.pop();
        if(endTag.tag != tagName){
            console.log('标签出错');
        }
    }

    function text(chars) {
        let parent = stack[stack.length-1];
        chars = chars.replace();
    }

    function parseStatrTag() {
        const start = html.match(startTagOpen);
        const match = {

        }
    }
    while(html){
        let index = html.indexOf('<');
        if(index==0){

        }
    }
}